package com.sn.system.tangs.tag;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.UIBean;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;

import com.opensymphony.xwork2.util.ValueStack;

@StrutsTag(name = "dialog", tldTagClass = "jp.co.sn.system.tangs.tag.DialogTag", description = "dialog")
public class Dialog extends UIBean{
	public Dialog(ValueStack stack, HttpServletRequest request,
			HttpServletResponse response) {
		super(stack, request, response);
	}

	private String id;
	private String title;
	private String msg;
	private String confirm;
	private String okFunction;
	private String cancelFunction;
	private String openFunction;
	private String focusOn;
	private String disabled;
	private String readonly;
	private String openButtonname;
	private String autoOpen;
	private String cssClass;
	private String cssStyle;

	@StrutsTagAttribute(description = "set id", type = "String")
	public void setId(String id) {
		this.id = id;
	}

	@StrutsTagAttribute(description = "set title", type = "String")
	public void setTitle(String title) {
		this.title = title;
	}

	@StrutsTagAttribute(description = "set msg", type = "String")
	public void setMsg(String msg) {
		this.msg = msg;
	}

	@StrutsTagAttribute(description = "set confirm", type = "String")
	public void setConfirm(String confirm) {
		this.confirm = confirm;
	}

	@StrutsTagAttribute(description = "set okFunction", type = "String")
	public void setOkFunction(String okFunction) {
		this.okFunction = okFunction;
	}

	@StrutsTagAttribute(description = "set cancelFunction", type = "String")
	public void setCancelFunction(String cancelFunction) {
		this.cancelFunction = cancelFunction;
	}

	@StrutsTagAttribute(description = "set focusOn", type = "String")
	public void setFocusOn(String focusOn) {
		this.focusOn = focusOn;
	}

	@StrutsTagAttribute(description = "set disabled", type = "String")
	public void setDisabled(String disabled) {
		this.disabled = disabled;
	}

	@StrutsTagAttribute(description = "set readonly", type = "String")
	public void setReadonly(String readonly) {
		this.readonly = readonly;
	}

	@StrutsTagAttribute(description = "set openButtonname", type = "String")
	public void setOpenButtonname(String openButtonname) {
		this.openButtonname = openButtonname;
	}

	@StrutsTagAttribute(description = "set autoOpen", type = "String")
	public void setAutoOpen(String autoOpen) {
		this.autoOpen = autoOpen;
	}

	@StrutsTagAttribute(description = "set cssClass", type = "String")
	public void setCssClass(String cssClass) {
		this.cssClass = cssClass;
	}

	@StrutsTagAttribute(description = "set cssStyle", type = "String")
	public void setCssStyle(String cssStyle) {
		this.cssStyle = cssStyle;
	}

	@StrutsTagAttribute(description = "set openFunction", type = "String")
	public void setOpenFunction(String openFunction) {
		this.openFunction = openFunction;
	}

	protected String getDefaultTemplate() {
		return "sn_dialog";
	}
	/**
	 * パラメータを設定する
	 */
	protected void evaluateExtraParams() {
		super.evaluateExtraParams();
		if (null != id) {
			addParameter("id", findString(id));
		}
		if (null != title) {
			addParameter("title", findString(title));
		}
		if (null != msg) {
			addParameter("msg", findString(msg));
		}
		if (null != confirm) {
			addParameter("confirm", findString(confirm));
		}
		if (null != okFunction) {
			addParameter("okFunction", findString(okFunction));
		}
		if (null != cancelFunction) {
			addParameter("cancelFunction", findString(cancelFunction));
		}
		if (null != focusOn) {
			addParameter("focusOn", findString(focusOn));
		}
		if (null != disabled) {
			addParameter("disabled", findString(disabled));
		}
		if (null != readonly) {
			addParameter("readonly", findString(readonly));
		}
		if (null != openButtonname) {
			addParameter("openButtonname", findString(openButtonname));
		}
		if (null != autoOpen) {
			addParameter("autoOpen", findString(autoOpen));
		}
		if (null != cssClass) {
			addParameter("cssClass", findString(cssClass));
		}
		if (null != cssStyle) {
			addParameter("cssStyle", findString(cssStyle));
		}
		if (null != openFunction) {
			addParameter("openFunction", findString(openFunction));
		}

	}
}
